package com.glsc.ngateway.common.base.repo.mysql.gateway.other;

import com.glsc.ngateway.common.base.domain.mysql.gateway.other.TradeAccountOwnFund;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface TradeAccountOwnFundRepository extends JpaRepository<TradeAccountOwnFund, Integer>, JpaSpecificationExecutor<TradeAccountOwnFund> {
    @Query(value = "select m from TradeAccountOwnFund m where m.dataStatus=0 " +
//            "and (:#{#paramSearchDto.shareHolderAccount} is null OR m.shareHolderAccount = :#{#paramSearchDto.shareHolderAccount})  " +
//            "and (:#{#paramSearchDto.shareHolderAccountName} is null OR m.shareHolderAccountName = :#{#paramSearchDto.shareHolderAccountName})  " +
            "and (:#{#paramSearchDto.fundAccount} is null OR m.fundAccount LIKE CONCAT('%',:#{#paramSearchDto.fundAccount},'%') )  " +
            "AND (:#{#paramSearchDto.plugInfo} is null OR m.plugInfo LIKE CONCAT('%',:#{#paramSearchDto.plugInfo},'%')) " +
            "AND (:#{#paramSearchDto.fundCompany} is null OR m.fundCompany LIKE CONCAT('%',:#{#paramSearchDto.fundCompany},'%')) " +
            "AND (:#{#paramSearchDto.ownFundPhone} is null OR m.ownFundPhone LIKE CONCAT('%',:#{#paramSearchDto.ownFundPhone},'%')) " +
            "AND (:#{#paramSearchDto.operatorInfo} is null OR m.operatorInfo LIKE CONCAT('%',:#{#paramSearchDto.operatorInfo},'%')) " +
            "AND (:#{#paramSearchDto.operatorInfoAccount} is null OR m.operatorInfoAccount LIKE CONCAT('%',:#{#paramSearchDto.operatorInfoAccount},'%')) " +
            "AND (:#{#paramSearchDto.stampInfo} is null OR m.stampInfo LIKE CONCAT('%',:#{#paramSearchDto.stampInfo},'%')) " +
            "AND (:#{#paramSearchDto.ownFundRelateBank} is null OR m.ownFundRelateBank LIKE CONCAT('%',:#{#paramSearchDto.ownFundRelateBank},'%')) " +
            "AND (:#{#paramSearchDto.ownFundRelateBankSelectName} is null OR m.ownFundRelateBankSelectName LIKE CONCAT('%',:#{#paramSearchDto.ownFundRelateBankSelectName},'%')) " +
            "AND (:#{#paramSearchDto.stampInfoSelectName} is null OR m.stampInfoSelectName LIKE CONCAT('%',:#{#paramSearchDto.stampInfoSelectName},'%'))" +
            "AND (:#{#paramSearchDto.openDate} is null OR m.openDate LIKE CONCAT('%',:#{#paramSearchDto.openDate},'%'))" +
//            "and (:#{#paramSearchDto.shareHolderAccountName} is null OR m.shareHolderAccountName LIKE CONCAT('%',:#{#paramSearchDto.shareHolderAccountName},'%') )  " +
//            "and (:#{#paramSearchDto.market} is null OR m.market = :#{#paramSearchDto.market})  " +
//            "and (:#{#paramSearchDto.status} is null OR m.status = :#{#paramSearchDto.status})  " +
//            "and (:#{#paramSearchDto.shareHolderUseDepartment} is null OR m.shareHolderUseDepartment = :#{#paramSearchDto.shareHolderUseDepartment})  " +
//            "and (:#{#paramSearchDto.belongDeptId} is null OR m.belongDeptId = :#{#paramSearchDto.belongDeptId})  " +
//            "and (:#{#paramSearchDto.opSupportName} is null OR m.opSupportName LIKE CONCAT('%',:#{#paramSearchDto.opSupportName},'%') )  " +
//            "and (:#{#paramSearchDto.systemSummary} is null OR m.systemSummary LIKE CONCAT('%',:#{#paramSearchDto.systemSummary},'%') )  " +
//            "and (:#{#paramSearchDto.processDefineKey} is null OR m.processDefineKey = :#{#paramSearchDto.processDefineKey} )  " +
//            "and (:#{#paramSearchDto.systemCode} is null OR m.systemCode = :#{#paramSearchDto.systemCode} )  " +
//            "and (:#{#paramSearchDto.beginDateLocalDate} is null OR m.processCreateTime >= :#{#paramSearchDto.beginDateLocalDate} )  " +
//            "and (:#{#paramSearchDto.endDateLocalDate} is null OR m.processCreateTime <= :#{#paramSearchDto.endDateLocalDate} )  " +
//            "and (:#{#paramSearchDto.hasProcessEnd} is null OR m.isClose = :#{#paramSearchDto.hasProcessEnd} )  " +
//            "and (coalesce(:#{#paramSearchDto.adminList}, null) is null or m.systemAdminAccount in (:#{#paramSearchDto.adminList})) " +
            "")
    Page<TradeAccountOwnFund> searchByParam(Pageable pageable, TradeAccountOwnFund paramSearchDto);
}



